/**
 * <copyright>
 * </copyright>
 *

 */
package edu.uwaterloo.bicycle.modeLanguage.impl;

import edu.uwaterloo.bicycle.modeLanguage.Expression;
import edu.uwaterloo.bicycle.modeLanguage.ModeLanguagePackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Expression</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link edu.uwaterloo.bicycle.modeLanguage.impl.ExpressionImpl#getBrackexpr <em>Brackexpr</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ExpressionImpl extends ConditionsImpl implements Expression
{
  /**
   * The cached value of the '{@link #getBrackexpr() <em>Brackexpr</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getBrackexpr()
   * @generated
   * @ordered
   */
  protected Expression brackexpr;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ExpressionImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return ModeLanguagePackage.Literals.EXPRESSION;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Expression getBrackexpr()
  {
    return brackexpr;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetBrackexpr(Expression newBrackexpr, NotificationChain msgs)
  {
    Expression oldBrackexpr = brackexpr;
    brackexpr = newBrackexpr;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModeLanguagePackage.EXPRESSION__BRACKEXPR, oldBrackexpr, newBrackexpr);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setBrackexpr(Expression newBrackexpr)
  {
    if (newBrackexpr != brackexpr)
    {
      NotificationChain msgs = null;
      if (brackexpr != null)
        msgs = ((InternalEObject)brackexpr).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModeLanguagePackage.EXPRESSION__BRACKEXPR, null, msgs);
      if (newBrackexpr != null)
        msgs = ((InternalEObject)newBrackexpr).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModeLanguagePackage.EXPRESSION__BRACKEXPR, null, msgs);
      msgs = basicSetBrackexpr(newBrackexpr, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ModeLanguagePackage.EXPRESSION__BRACKEXPR, newBrackexpr, newBrackexpr));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case ModeLanguagePackage.EXPRESSION__BRACKEXPR:
        return basicSetBrackexpr(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case ModeLanguagePackage.EXPRESSION__BRACKEXPR:
        return getBrackexpr();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case ModeLanguagePackage.EXPRESSION__BRACKEXPR:
        setBrackexpr((Expression)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ModeLanguagePackage.EXPRESSION__BRACKEXPR:
        setBrackexpr((Expression)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case ModeLanguagePackage.EXPRESSION__BRACKEXPR:
        return brackexpr != null;
    }
    return super.eIsSet(featureID);
  }

} //ExpressionImpl
